home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.arch.arithmetic,comp.lang.c,comp.lang.c++
- Subject: Re: Access carry flag from C
- Date: 23 Feb 1996 17:20:29 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Feb23102029@qcd.lanl.gov>
- References: <Dn1C9z.DGv.0.net@indra.com> <1996Feb1922.17.19.879@koobera.math.uic.edu>
- <31298D20.41C6@bazis.nl> <danpop.824859220@rscernix>
- <312AFACE.41C6@bazis.nl> <824997378snz@genesis.demon.co.uk>
- <312D850C.2781@bazis.nl>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: Franz Korntner's message of Fri, 23 Feb 1996 09:12:44 GMT
-
- In article <312D850C.2781@bazis.nl>
- Franz Korntner <fkorntne@bazis.nl> writes:
-
-
- FK: >
- FK: > >According to the (X3J11 / ANSI) standard, the constant
- FK: > >INT_MAX (and in this case most limits in limits.h) denotes the minimal
- FK: > >limit. It is possible that the physical limit is much higher (or lower
- FK: > >in the case of negative values).
- FK: >
- FK: > No. The value defined for INT_MAX in limits.h is the maximum value an int
- FK: > can hold *on that particular implementation*. The standard requires that
- FK: > INT_MAX be at least 32767 on all implementations (but it can be and
- FK: > often is higher). So on any implementation:
- FK: >
- FK: > int x = INT_MAX+1;
- FK: >
- FK: > is a guaranteed overflow.
- FK:
- FK: Wrong. The limits are minima. The above operation does not have to
- overflow!
-
- Instead of claiming it is wrong, read the standard. (My previous post
- quotes the relevant parts). Where do you find that the `limits are
- minima'? What are minima? How can a token like `INT_MAX' be a minima:
- I know of no comparison function between tokens without values.
-
- (The standard only says that INT_MAX >= 32767: I think you misread
- this and hallucinated that INT_MAX is useless.)
-
- FK:
- FK: > >and what I really miss in the
- FK: > >standard and/or implementation is a inline function 'maxlimitof(int)',
- FK: > >analogical to 'sizeof(int)'.
- FK: >
- FK: > That is precisely what INT_MAX gives you.
- FK:
- FK: INT_MAX is a constant. On some platforms you can force GCC to assume int's
- FK: to be 16 bit values. What about INT_MAX then?!?
-
- There is no standard conforming way of forcing int's to be 16 bit
- values. If an implementation wants to allow a compiler flag to allow
- such a thing, it is the compiler's responsibility to make sure that
- INT_MAX gets defined appropriately.
-
- What do you mean by INT_MAX is a constant? INT_MAX is a token: and is
- defined in <limits.h> with a constant int value which is
- implementation dependent: an implementation is not only a compiler,
- but a compiler with a method of invoking it.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-